//
//  FXCryptoSecurity.h
//  cryptox
//
//  Created by FXY on 2022/3/31.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface FXCryptoSecurity : NSObject

#pragma mark - RSA加密

// return base64 encoded string
+ (NSString *)encryptString:(NSString *)str publicKey:(NSString *)pubKey;
// return raw data
+ (NSData *)encryptData:(NSData *)data publicKey:(NSString *)pubKey;
// return base64 encoded string
+ (NSString *)encryptString:(NSString *)str privateKey:(NSString *)privKey;
// return raw data
+ (NSData *)encryptData:(NSData *)data privateKey:(NSString *)privKey;

// decrypt base64 encoded string, convert result to string(not base64 encoded)
+ (NSString *)decryptString:(NSString *)str publicKey:(NSString *)pubKey;
+ (NSData *)decryptData:(NSData *)data publicKey:(NSString *)pubKey;
+ (NSString *)decryptString:(NSString *)str privateKey:(NSString *)privKey;
+ (NSData *)decryptData:(NSData *)data privateKey:(NSString *)privKey;

+ (NSString *)hmacSHA256WithSecret:(NSString *)secret data:(NSDictionary *)data;


#pragma mark - AES加密
/// 加密
+ (NSData *)aes256_encrypt:(NSString *)key data:(NSData *)data;

/// 解密
+ (NSData *)aes256_decrypt:(NSString *)key data:(NSData *)data;

/// 加密
+ (NSString *) aes256_encrypt:(NSString *)key text:(NSString *)text;

/// 解密
+ (NSString *)aes256_decrypt:(NSString *)key text:(NSString *)text;

+ (NSString *)sha256HashOfFileAtPath:(NSString *)filePath;

@end

NS_ASSUME_NONNULL_END
